/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.univali.sindico.dao;

import br.univali.sindico.entity.Apartamento;
import java.util.List;
import org.hibernate.Transaction;
import org.hibernate.classic.Session;

/**
 *
 * @author Fernando
 */
public class ApartamentoDAO extends GenericDAO<Apartamento> {
    
    public List<Apartamento> getAllbyBloco(int bloco){
        Session session = sessionFactory.openSession();
        Transaction t = session.beginTransaction();        
        List<Apartamento> result = session.createQuery("from Apartamento ap where ap.blocoCodigo.codigo = " + bloco).list();
        t.commit();
        session.close();
        return result;
    }
            
    
}
